<template>
  <div id="app" :style="{
            // backgroundImage: `url('${bgImage}')`,
        }"
  >
    <router-view></router-view>
  </div>
</template>

<script>

  export default {
    name: 'db-tool',

    data() {
      return {
        bgImage: 'static/images/bg.jpg',
      }
    },

    methods: {
      /**
       * 注册全局快捷键
       */
      registGlobalShortcut() {
        const shortcuts = {
          "CommandOrControl+N": () => {
            this.$store.dispatch("toggleLoginDialog", {visible: true});
          },
        };

        for (let accelerator in shortcuts) {
          if (shortcuts.hasOwnProperty(accelerator)) {
            if (this.$electron.remote.globalShortcut.isRegistered(accelerator)) {
              this.$electron.remote.globalShortcut.unregister(accelerator)
            }
            this.$electron.remote.globalShortcut.register(accelerator, shortcuts[accelerator]);
          }
        }
      },
    },

    async mounted() {
      this.registGlobalShortcut();
    },
  }
</script>

<style lang="scss">
  #app {
    height: 100%;
    background-repeat: no-repeat;
    -webkit-background-size: 100% 100%;
    background-size: 100% 100%;
  }
</style>
